@extends("admin.frame_layout")
<?php $top_selected = "信息管理";$page_menu = "系统公告" ?>
@section('content')
    <div class="rightinfo">
        <div class="tools">
            <ul class="toolbar">
                <li>
                    <a href="{{route('admin.notices.edit',['id'=>0])}}">
                        <span><img src="{{asset('admin/imgs/t01.png')}}"/></span>发布新公告
                    </a>
                </li>
            </ul>
        </div>

        <table class="tablelist">
            <thead>
            <tr>
                <th width="70px">操作</th>
                <th width="100px">编号<i class="sort"><img src="{{asset('admin/imgs/px.gif')}}"/></i></th>
                <th width="100px">已读人数</th>
                <th style="text-align: left;">公告标题</th>
                <th width="150px">开始时间</th>
                <th width="150px">结束时间</th>
                <th width="100px">是否过期</th>
                <th width="150px">更新时间</th>
            </tr>
            </thead>
            <tbody>
            @foreach($notices as $item)
                <tr>
                    <td class="act" bind="#{{$item->id}}">
                        <img src="{{asset('admin/imgs/t05.png')}}"/>菜单
                        <ul id="{{$item->id}}">
                            <li>
                                <a href="{{route('admin.notices.edit',['id'=>$item->id])}}">
                                    <img src="{{asset('admin/imgs/d02.png')}}"/>编辑公告
                                </a>
                            </li>
                            <li onclick="openOkDlg('{{route('admin.notices.del',['id'=>$item->id])}}')">
                                <img src="{{asset('admin/imgs/d02.png')}}"/>删除
                            </li>
                        </ul>
                    </td>
                    <td>{{$item->id}}</td>
                    <td>{{$item->read}}</td>
                    <td class="text-left">{{$item->title}}</td>
                    <td>{{date("Y-m-d H:i:s",$item->start)}}</td>
                    <td>{{date("Y-m-d H:i:s",$item->end)}}</td>
                    <td>
                        @if($item->end < time())
                            <span class="red">已过期</span>
                        @else
                            <span class="green">未过期</span>
                        @endif
                    </td>
                    <td>{{date("Y-m-d H:i:s",$item->time)}}</td>
                </tr>
            @endforeach
            </tbody>
        </table>
        @include('admin.coms.fenye')
    </div>

    @include('admin.coms.dialog')
@endsection
@section('footer')
    <script type="text/javascript">
        $(document).ready(function () {
            //初始化表格操作菜单
            $('.tablelist tbody tr:odd').addClass('odd');
            $(".tablelist .act").hover(function () {
                $($(this).attr("bind")).show();
            }, function () {
                $($(this).attr("bind")).hide();
            });
        });
    </script>
@endsection

